def spam():
    global eggs  # global
    eggs = 'spam'
def bacon():
    eggs = 'bacon'  # local
    print('Bacon函数：' + eggs)
def ham():
    print('ham函数：' + eggs)  # global

eggs = 42
spam()
print('主程序：' + eggs)
bacon()
print('主程序：' + eggs)
ham()
